from fastapi import APIRouter, Depends
from fastapi.security import OAuth2PasswordRequestForm

from api.v1.auth.schemas import Token
from api.v1.auth.services import user_check

auth = APIRouter(tags=["auth"], prefix="/auth")


@auth.post("/login", summary="管理员用户登录", response_model=Token)
async def admin_user_login(form: OAuth2PasswordRequestForm = Depends()):
    """
    管理员登陆
    :param form:
    :param username:
    :param password:
    :return:
    """

    return await user_check(form.username, form.password)
